﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LyncServerExtension.Plugin.WebPage
{
    /// <summary>
    /// Class to represent a web page listing users.
    /// </summary>
    public sealed class UserListPage : DefaultPage
    {
        private IEnumerable<LyncUser> users;

        /// <summary>
        /// Initializes a new instance of the <see cref="UserListPage"/> class.
        /// </summary>
        /// <param name="users">The users.</param>
        public UserListPage(IEnumerable<LyncUser> users)
        {
            this.users = users;
        }

        /// <summary>
        /// Gets the content.
        /// </summary>
        public override string Content
        {
            get
            {
                return string.Format("<h3>{0}</h3><hr/><p>Users are:<br/><ul>{1}<ul></p>",
                  Title, string.Concat(users.Select((u) => string.Concat("<li>", u.Sip, "</li>"))));
            }
        }
    }
}
